<?php
/*
 * Get all the badges the user have
 */
// authenticate user first
F3::call('authentication.php');
	
if (F3::exists('auth_error'))
{
  // authentication failed
  return;
}

$uid = F3::get('SESSION.user_id');
$param = array('1' => $uid);

$result = DB::sql("SELECT badges.name from badges join user_badges on badges.id=user_badges.bid where user_badges.uid = ?", $param);

header('HTTP/1.1 200');
header("Content-Type: application/json");
echo json_encode($result);
?>